home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3779 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  45 lines

  1. Path: diku.dk!not-for-mail
  2. From: Morten B=?iso-8859-2?Q?=F8geskov Jensen <bogeskov@diku.dk>?=
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: 3 bugs in SAS/C v. 6.56
  5. Date: Sat, 24 Feb 1996 12:48:22 +0100
  6. Organization: S.A.T.S.
  7. Sender: bogeskov@fjalar.diku.dk
  8. Message-ID: <312EFB06.708D@diku.dk>
  9. References: <4gjvvc$a3t@gjallar.daimi.aau.dk>
  10. NNTP-Posting-Host: odin.diku.dk
  11. Mime-Version: 1.0
  12. Content-Type: text/plain; charset=iso-8859-2
  13. Content-Transfer-Encoding: 7bit
  14. X-Mailer: Mozilla 2.0 (X11; I; HP-UX A.09.05 9000/715)
  15.  
  16. #include <stdio.h>
  17.  
  18. int main(void)
  19. {
  20.     unsigned short a = 0xffff, b = 0xffff;
  21.  
  22.     if ((a | b) > (unsigned short)0x7fff) {
  23.         printf("ok\n");
  24.     } else {
  25.         printf("bad\n");
  26.     }
  27.     return 0;
  28. }
  29.  
  30. This should work.. But I haven't tested it, since I'm not at home, so I
  31. cannot reach out and get SAS/C.
  32. However I belive that ">" and other boolean operations are
  33. left-associative (I know), as so they take the type of the 2nd (right)
  34. parameter, and since 0x7fff per default is signed, there is an implicit
  35. type conversion of unsigned short to signed short. this is most
  36. unfortunate, however this is the way most C-compilers work.
  37.  
  38. The other 2 examples I couldnt see why they wouldn't work.
  39.  
  40. -- 
  41. 8)
  42.   Morten bogeskov@diku.dk
  43.  
  44. .. one mans constant is another mans variable
  45.